package org.example.salesystem.service.impl;

import org.example.salesystem.mapper.RegisterUserMapper;
import org.example.salesystem.service.RegisterUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RegisterUserServiceimpl implements RegisterUserService {
    @Autowired
    private RegisterUserMapper registerUserMapper;
    @Override
    public int checkPhoneNumber(String phonenumber)
    {
        if(registerUserMapper.checkPhoneNumber(phonenumber) ==null)
        {
            return 0;
        }
        else
            return 1;
    }
    @Override
    public int checkEmail(String email)
    {
        if(registerUserMapper.checkEmail(email) ==null)
            return 0;
        else
            return 1;
    }
    @Override
    public  int  checkUserName(String username)
    {
        if(registerUserMapper.checkUserName(username) ==null)
        {
            return 0;
        }
        return 1;
    }
    //增加用户
    @Override
    public  int RegisterUser(String username, String password1,String  phonenumber, String email)
    {
        if(registerUserMapper.RegisterUser (username,  password1, phonenumber, email)==1)
            return 1;
        else
            return 0;
    }

}
